Conversation
viktorprogger
commented
Dec 13, 2025
| Q | A |
|---|---|
| Is bugfix? | ✔️ |
| New feature? | ❌ |
| Breaks BC? | ❌ |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #250 +/- ##
============================================
- Coverage 98.62% 98.50% -0.13%
+ Complexity 356 353 -3
============================================
Files 47 47
Lines 948 937 -11
============================================
- Hits 935 923 -12
- Misses 13 14 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-authored-by: Alexander Makarov <sam@rmcreative.ru>
Co-authored-by: Alexander Makarov <sam@rmcreative.ru>
There was a problem hiding this comment.
Pull request overview
This pull request is marked as a bugfix and includes significant documentation improvements, code refactoring, and a critical bug fix. The main changes involve integrating CallableFactory into the Worker class to simplify handler resolution, fixing a bug in the JSON message serializer, adding comprehensive documentation, and adding a command alias.
Key changes:
- Integration of
CallableFactoryintoWorkerfor unified callable resolution - Bug fix in
JsonMessageSerializerwhere$payload['meta']was incorrectly accessed instead of$meta - Extensive documentation added covering queue channels, message handlers, middleware pipelines, error handling, and more
- Command alias
queue:listen-alladded to replace the typoqueue:listen:all
Reviewed changes
Copilot reviewed 29 out of 29 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Unit/WorkerTest.php | Added new test case for object method callable definitions and updated tests to use CallableFactory parameter |
| tests/Unit/Middleware/CallableFactoryTest.php | Major refactoring with data providers for comprehensive testing of callable factory scenarios |
| tests/TestCase.php | Added CallableFactory parameter to worker creation |
| tests/Integration/MiddlewareTest.php | Added CallableFactory parameter to test setup |
| tests/Integration/MessageConsumingTest.php | Added CallableFactory instantiation and parameter in worker setup |
| tests/Benchmark/QueueBench.php | Added CallableFactory parameter to worker constructor |
| src/Worker/Worker.php | Integrated CallableFactory for unified handler resolution, simplified handler caching logic |
| src/Middleware/CallableFactory.php | Enhanced to support Closure detection, object method definitions, and improved validation |
| src/Message/JsonMessageSerializer.php | Bug fix: corrected variable reference from $payload['meta'] to $meta |
| src/Command/ListenAllCommand.php | Added command alias 'queue:listen:all' for backward compatibility |
| docs/guide/en/worker.md | Rewritten to focus on starting workers and supervisor configuration |
| docs/guide/en/usage.md | Expanded with queue channels, delayed execution, job status examples |
| docs/guide/en/producing-messages-from-external-systems.md | New comprehensive guide for external message producers |
| docs/guide/en/prerequisites-and-installation.md | New installation and requirements guide |
| docs/guide/en/middleware-pipelines.md | New detailed middleware pipeline documentation |
| docs/guide/en/message-handler.md | New guide explaining handler definition formats and configuration |
| docs/guide/en/loops.md | New documentation on loop interface and signal handling |
| docs/guide/en/job-status.md | New guide on job status tracking |
| docs/guide/en/error-handling.md | Significantly expanded with step-by-step failure handling flow |
| docs/guide/en/envelopes.md | New documentation on envelope pattern and metadata handling |
| docs/guide/en/debug-integration.md | New guide for Yii Debug integration |
| docs/guide/en/console-commands.md | New comprehensive console commands reference |
| docs/guide/en/configuration-with-config.md | New configuration guide for yiisoft/config users |
| docs/guide/en/configuration-manual.md | New manual configuration guide with examples |
| docs/guide/en/channels.md | New detailed guide on queue channels concept and configuration |
| docs/guide/en/callable-definitions-extended.md | New guide explaining extended callable definition formats |
| docs/guide/en/README.md | Restructured guide index with better organization |
| config/params.php | Added 'queue:listen-all' command alias |
| README.md | Major rewrite with quick start guide and improved structure |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ## Configuration | ||
| ## When failure handling is triggered | ||
|
|
||
| Failure handling is triggered only when message processing throws a `Throwable`. |
There was a problem hiding this comment.
How about PHP notices or warnings or errors?
| 'queue:run' => RunCommand::class, | ||
| 'queue:listen' => ListenCommand::class, | ||
| 'queue:listen:all' => ListenAllCommand::class, | ||
| 'queue:listen-all' => ListenAllCommand::class, |
There was a problem hiding this comment.
I think it was alright. The console works the best when the separator is :.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 38 out of 38 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| $name = $message->getHandlerName(); | ||
| $handler = $this->getHandler($name); | ||
| try { | ||
| $handler = $this->getHandler($name); | ||
| } catch (InvalidCallableConfigurationException $exception) { | ||
| throw new RuntimeException(sprintf('Queue handler with name "%s" does not exist.', $name), 0, $exception); | ||
| } | ||
|
|
||
| if ($handler === null) { | ||
| throw new RuntimeException(sprintf('Queue handler with name "%s" does not exist', $name)); | ||
| } |
There was a problem hiding this comment.
process() throws two different error messages for missing/invalid handler definitions: the InvalidCallableConfigurationException path ends with a period (... does not exist.) while the null handler path does not (... does not exist). This difference breaks tests that expect a stable message and makes error handling brittle. Consider using a single canonical message string for both paths (or update tests/BC accordingly).
| $this->addArgument( | ||
| 'channel', | ||
| InputArgument::OPTIONAL | InputArgument::IS_ARRAY, | ||
| 'Queue channel name list to connect to.', | ||
| $this->channels, | ||
| ) | ||
| ->addOption( | ||
| 'maximum', | ||
| 'limit', | ||
| 'm', | ||
| InputOption::VALUE_REQUIRED, | ||
| 'Maximum number of messages to process in each channel. Default is 0 (no limits).', | ||
| 'Number of messages to process in each channel. Default is 0 (no limits).', | ||
| 0, | ||
| ) | ||
| ->addUsage('[channel1 [channel2 [...]]] --maximum 100'); | ||
| ->addUsage('[channel1 [channel2 [...]]] --limit 100'); |
There was a problem hiding this comment.
The CLI option name was changed from --maximum to --limit. That is a backwards-incompatible change for anyone scripting this command, but the PR metadata says BC is not broken. Consider supporting --maximum as a deprecated alias (or documenting this as a BC break and updating release notes).
| ->addOption( | ||
| 'pause', | ||
| 'p', | ||
| InputOption::VALUE_REQUIRED, | ||
| 'Pause between queue channel iterations in seconds. May save some CPU. Default: 1', | ||
| 1, | ||
| ) | ||
| ->addOption( | ||
| 'maximum', | ||
| 'limit', | ||
| 'm', | ||
| InputOption::VALUE_REQUIRED, | ||
| 'Maximum number of messages to process in each channel before switching to another channel. ' | ||
| 'Number of messages to process in each channel before switching to another channel. ' | ||
| . 'Default is 0 (no limits).', | ||
| 0, | ||
| ); | ||
|
|
||
| $this->addUsage('[channel1 [channel2 [...]]] [--timeout=<timeout>] [--maximum=<maximum>]'); | ||
| $this->addUsage('[channel1 [channel2 [...]]] [--pause=<pause>] [--limit=<limit>]'); |
There was a problem hiding this comment.
The queue:listen-all command option was renamed from --maximum to --limit. This is a breaking CLI interface change (scripts/ops tooling will fail) while the PR metadata indicates no BC break. Consider keeping --maximum as an alias (possibly deprecated) or updating the PR metadata / changelog to reflect the breaking change.
| - [Middleware pipelines deep dive](middleware-pipelines.md) — dispatcher lifecycle, request mutations, and per-pipeline contracts. | ||
| - [Callable definitions and middleware factories](callable-definitions-extended.md) — container-aware definitions for middleware factories. | ||
| - [Error handling](error-handling.md#failure-pipeline-overview) — end-to-end flow of the failure pipeline. | ||
| - [Custom failure middleware](error-handling.md#how-to-create-a-custom-failure-middleware) — implementing `MiddlewareFailureInterface`. | ||
| - [Envelope metadata and stack reconstruction](envelopes.md#metadata-and-envelope-stacking) — stack resolution and metadata merging. | ||
| - [FailureEnvelope usage](error-handling.md#failureenvelope) — retry metadata semantics. | ||
| - [Handler resolver pipeline](message-handler.md#resolver-pipeline) — alternative handler lookup strategies. | ||
|
|
||
| ## Queue adapters and interoperability | ||
|
|
||
| - [Custom queue provider implementations](queue-names-advanced.md#extending-the-registry) — bespoke selection logic, tenant registries, and fallback strategies. | ||
| - [Consuming messages from external systems](consuming-messages-from-external-systems.md) — contract for third-party producers. | ||
| - [Adapter internals](adapter-list.md#available-adapters) — extend or swap backend adapters. | ||
|
|
||
| ## Tooling, diagnostics, and storage | ||
|
|
||
| - [Yii Debug collector internals](debug-integration-advanced.md) — collector internals, proxies, and manual wiring. | ||
| - [Job status storage extensions](job-status.md#extend-storage) — persisting custom metadata or drivers. | ||
| - [Extending queue processes and supervisors](process-managers.md#custom-supervisors) — custom supervisor hooks and graceful shutdown integration. |
There was a problem hiding this comment.
Several anchors referenced here don’t exist in the target docs, so these links are currently broken on GitHub: error-handling.md#failure-pipeline-overview (heading is different), message-handler.md#resolver-pipeline, job-status.md#extend-storage, and process-managers.md#custom-supervisors. Please update the anchors (or add the missing sections) so the documentation map is navigable.